<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page import="com.ckeditor.CKEditorConfig"%>
<%@ taglib uri="http://ckeditor.com" prefix="ckeditor"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">

<head>

<!-- Basic -->
<meta charset="UTF-8" />

<title>文章类型管理</title>

<!-- Mobile Metas -->
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

<!-- Import google fonts -->
<link
	href="http://fonts.useso.com/css?family=Open+Sans:300,400,600,700,800|Shadows+Into+Light"
	rel="stylesheet" type="text/css" />

<!-- Favicon and touch icons -->
<link rel="shortcut icon" href="<%=path%>/assets/ico/favicon.ico"
	type="image/x-icon" />
<link rel="apple-touch-icon"
	href="<%=path%>/assets/ico/apple-touch-icon.png" />
<link rel="apple-touch-icon" sizes="57x57"
	href="<%=path%>/assets/ico/apple-touch-icon-57x57.png" />
<link rel="apple-touch-icon" sizes="72x72"
	href="<%=path%>/assets/ico/apple-touch-icon-72x72.png" />
<link rel="apple-touch-icon" sizes="76x76"
	href="<%=path%>/assets/ico/apple-touch-icon-76x76.png" />
<link rel="apple-touch-icon" sizes="114x114"
	href="<%=path%>/assets/ico/apple-touch-icon-114x114.png" />
<link rel="apple-touch-icon" sizes="120x120"
	href="<%=path%>/assets/ico/apple-touch-icon-120x120.png" />
<link rel="apple-touch-icon" sizes="144x144"
	href="<%=path%>/assets/ico/apple-touch-icon-144x144.png" />
<link rel="apple-touch-icon" sizes="152x152"
	href="<%=path%>/assets/ico/apple-touch-icon-152x152.png" />

<!-- start: CSS file-->

<!-- Vendor CSS-->
<link href="<%=path%>/assets/vendor/bootstrap/css/bootstrap.min.css"
	rel="stylesheet" />
<link href="<%=path%>/assets/vendor/skycons/css/skycons.css"
	rel="stylesheet" />
<link
	href="<%=path%>/assets/vendor/font-awesome/css/font-awesome.min.css"
	rel="stylesheet" />

<!-- Plugins CSS-->
<link href="<%=path%>/assets/plugins/bootkit/css/bootkit.css"
	rel="stylesheet" />
<link
	href="<%=path%>/assets/plugins/jquery-ui/css/jquery-ui-1.10.4.min.css"
	rel="stylesheet" />
<link
	href="<%=path%>/assets/plugins/editable/css/bootstrap-editable.css"
	rel="stylesheet" />

<!-- Theme CSS -->
<link href="<%=path%>/assets/css/jquery.mmenu.css" rel="stylesheet" />

<!-- Page CSS -->
<link href="<%=path%>/assets/css/style.css" rel="stylesheet" />
<link href="<%=path%>/assets/css/add-ons.min.css" rel="stylesheet" />
<!-- end: CSS file-->


<!-- Head Libs -->
<script src="<%=path%>/assets/plugins/modernizr/js/modernizr.js"></script>

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
			<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
			<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
		<![endif]-->

<base href="<%=basePath%>">

<script type="text/javascript">
	function checkadd() {
		var articleType = document.getElementById("addNewArticleType").value;
		if (articleType.length == 0) {
			alert("添加类型不能为空");
			return false;
		}
	}
	function checkdel() {
		var arr = new Array();
		var items = document.getElementsByName("articleTypeCheckbox");
		for (i = 0; i < items.length; i++) {
			if (items[i].checked) {
				arr.push(items[i].value);
			}
		}
		if (arr.length == 0) {
			alert("没有选到要删除的项目哦！");
			return false;
		} else {
			if (!confirm("确定删除吗？")) {
				window.event.returnValue = false;
			}
			return true;
		}
	}
</script>

</head>

<body>
	<!-- Start: Content -->
	<div class="container-fluid content">
		<div class="row">

			<!-- 加载header -->
			<jsp:include page="include/header.jsp"></jsp:include>
			<!-- 加载sidebar -->
			<jsp:include page="include/sidebar.jsp"></jsp:include>

			<!-- Main Page -->
			<div class="main ">
				<!-- Page Header -->
				<div class="page-header">
					<div class="pull-left">
						<ol class="breadcrumb visible-sm visible-md visible-lg">
							<li><a
								href="<%=path%>/user/index?userId=${sessionScope.user.userId}"><i
									class="icon fa fa-home"></i>首页</a></li>
							<li class="active"><i class="fa fa-pencil"></i>文章类型管理</li>
						</ol>
					</div>
				</div>
				<!-- End Page Header -->
				<div class="row">
					<div class="col-lg-12">
						<div class="panel bk-bg-white">
							<div class="panel-heading bk-bg-primary">
								<h6>
									<i class="fa fa-pencil red"></i>添加类型
								</h6>
								<div class="panel-actions">
									<a href="form-x-editable.html#" class="btn-minimize"><i
										class="fa fa-chevron-up"></i></a>
								</div>
							</div>
							<div class="panel-body">
								<div class="col-md-3">
									<form action="<%=path%>/articleType/addArticleType"
										name="addArticleTypeFirm" id="ArticleForm" method="post">
										<input type="submit" name="submit" value="添加"
											onClick="return checkadd()"> <span
											style="color: green">${requestScope.createSucceed}</span> <span
											style="color: red">${requestScope.createFailed}</span>
										<table id="user" class="table table-bordered table-striped"
											style="clear: both">
											<tbody>
												<tr>
													<td width="50%"><input type="hidden" name="userId"
														value="${sessionScope.user.userId}"><input
														type="text" name="articleType" id="addNewArticleType" /></td>
												</tr>
											</tbody>
										</table>
									</form>
								</div>

							</div>
						</div>
					</div>
				</div>

				<div class="row">
					<div class="col-lg-12">
						<div class="panel bk-bg-white">
							<div class="panel-heading bk-bg-primary">
								<h6>
									<i class="fa fa-pencil red"></i>删除类型
								</h6>
								<div class="panel-actions">
									<a href="form-x-editable.html#" class="btn-minimize"><i
										class="fa fa-chevron-up"></i></a>
								</div>
							</div>
							<div class="panel-body">
								<div class="col-md-3">
									<form action="<%=path%>/articleType/deleteArticleType"
										name="deleteArticleTypeFirm" id="DeleteArticleForm"
										method="post">
										<input type="submit" name="submit" value="删除"
											onblur="return checkdel()"> <span
											style="color: green">${requestScope.deleteSucceed}</span> <span
											style="color: red">${requestScope.deleteFailed}</span>
										<table id="user" class="table table-bordered table-striped"
											style="clear: both">
											<tbody>
												<c:forEach items="${requestScope.articleTypes}" var="item">
													<tr>
														<td><input type="checkbox" name="types"
															value="${item.articleType}"> ${item.articleType}</td>
													</tr>
												</c:forEach>
											</tbody>
										</table>
									</form>
								</div>

							</div>
						</div>
					</div>
				</div>
			</div>
			<!-- End Main Page -->
		</div>
		<!--/container-->
	</div>


	<div class="clearfix"></div>


	<!-- start: JavaScript-->

	<!-- Vendor JS-->
	<script src="<%=path%>/assets/vendor/js/jquery.min.js"></script>
	<script src="<%=path%>/assets/vendor/js/jquery-2.1.1.min.js"></script>
	<script src="<%=path%>/assets/vendor/js/jquery-migrate-1.2.1.min.js"></script>
	<script src="<%=path%>/assets/vendor/bootstrap/js/bootstrap.min.js"></script>
	<script src="<%=path%>/assets/vendor/skycons/js/skycons.js"></script>

	<!-- Plugins JS-->
	<script
		src="<%=path%>/assets/plugins/jquery-ui/js/jquery-ui-1.10.4.min.js"></script>
	<script src="<%=path%>/assets/plugins/mockjax/js/jquery.mockjax.min.js"></script>
	<script
		src="<%=path%>/assets/plugins/editable/js/bootstrap-editable.min.js"></script>
	<script src="<%=path%>/assets/plugins/moment/js/moment.min.js"></script>
	<script
		src="<%=path%>/assets/plugins/editable/inputs-ext/typeaheadjs/typeaheadjs.min.js"></script>
	<script
		src="<%=path%>/assets/plugins/editable/inputs-ext/address/address.min.js"></script>
	<script src="<%=path%>/assets/plugins/select2/js/select2.min.js"></script>

	<!-- Theme JS -->
	<script src="<%=path%>/assets/js/jquery.mmenu.min.js"></script>
	<script src="<%=path%>/assets/js/core.min.js"></script>

	<!-- Pages JS -->
	<script src="<%=path%>/assets/js/pages/form-x-editable-demo.js"></script>
	<script src="<%=path%>/assets/js/pages/form-x-editable.js"></script>
	<script src="<%=path%>/ckeditor/ckeditor.js"></script>
	<!-- end: JavaScript-->
</body>

</html>